home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nebula 2
/
Nebula Two.iso
/
SourceCode
/
AlexNeXTSTEPSource
/
Source
/
Chapter6_Events
/
DelegateDemo
/
WindowDelegate.m
< prev
Wrap
Text File
|
1995-06-12
|
709b
|
40 lines
#import <appkit/appkit.h>
#import "WindowDelegate.h"
#define SAVE NX_ALERTDEFAULT
#define CLOSE NX_ALERTALTERNATE
#define CANCEL NX_ALERTOTHER
@implementation WindowDelegate
- windowWillClose:sender
{
int result;
result = NXRunAlertPanel
([NXApp appName],
"Unsaved changes. Close Anyway?\n",
"Save",
"Close anyway",
"Cancel");
switch(result)
{
case SAVE:
printf("Save button selected\n");
printf("Saving...\n");
printf("Closing window\n\n");
break;
case CLOSE:
printf("Close button selected\n");
printf("Closing window\n\n");
break;
case CANCEL:
printf("Cancel button selected\n");
printf("Window won't close\n\n");
return nil;
}
return self;
}
@end